package cn.edu.nju.setting;

import java.util.List;

import cn.edu.nju.R;

import android.app.Activity;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.TextView;

public class TagAdapter extends BaseAdapter{
	private Activity context;
	private LayoutInflater inflater;
	private List<String> tags;
		
	public TagAdapter(Activity activity, List<String> tags){
		this.context = activity;
		this.tags = tags;
		this.inflater = context.getLayoutInflater();
	}
	
	public int getCount() {
		return tags.size();
	}

	public Object getItem(int position) {
		return tags.get(position);
	}

	public long getItemId(int position) {
		return position;
	}

	public View getView(int position, View convertView, ViewGroup parent) {
		TextView tagView;
		if(convertView == null){
			tagView = (TextView)inflater.inflate(R.layout.normal_tag, null);
		}
		else{
			tagView = (TextView)convertView;
		}
		tagView.setText(tags.get(position));
		return tagView;
	}	
}
